{layout name="common/layout" /}
<div class="bj_hui">
    <div class="zt_da">

        <div class="zx_lie_left">
            <p>珠宝资讯</p>
            <ul>
                <li><a href="/addons/shop/info/list?type=2" class="{:$type==2?'on':''}">珠宝标准</a></li>
                <li><a href="/addons/shop/info/list?type=3" class="{:$type==3?'on':''}">珠宝知识</a></li>
                <li><a href="/addons/shop/info/list?type=4" class="{:$type==4?'on':''}">胡博士翡翠大讲堂</a></li>
            </ul>
        </div>

        <div class="zx_lie_right">

            <div class="zx_lie_right_1">{if $type == 2}珠宝标准{elseif $type==3}珠宝知识{else/}胡博士翡翠大讲堂{/if}</div>
            <div class="zx_lie_right_2">
                <ul>
                    <li><a href="/addons/shop/info/list?type=2" class="{:$sort_id==''?'on':''}">全部</a></li>
                    {foreach name="info_sort" item="vo"}
                    <li><a href="/addons/shop/info/list?type={$type}&sort_id={$vo.id}" class="{:$sort_id==$vo.id?'on':''}">{$vo.name}</a></li>
                    {/foreach}
                </ul>
            </div>
            <div class="zx_lie_right_3">
                <ul>
                    {foreach name="data" item="vo"}
                    <li>
                        <div class="zx_lie_rightt_l" style="margin-right: 10px;">
                            <img src="{$vo.image|cdnurl}" width="139" height="99"/>
                        </div>
                        <div class="zx_lie_rightt_2">
                            <a href="/addons/shop/info/detail?article_id={$vo.id}">{$vo.title}</a>
                        </div>
                        <div class="zx_lie_rightt_3">{$vo.explain}</div>
                        <div class="zx_lie_rightt_4">
                            <span>{$vo.createtime|human_date}</span>
                            <p class="r1">
                                {if $vo.is_fabulous == 1}
                                <a onclick="submitFabulous({$vo.id})" href="javascript:;" style="color: red">点赞（{$vo.fabulous_sum}）</a>
                                {else/}
                                <a onclick="submitFabulous({$vo.id})" href="javascript:;">点赞 （{$vo.fabulous_sum}）</a>
                                {/if}
                            </p>
                            <p class="r2"><a href="">评论（{$vo.comment_sum}）</a></p>
                            <p class="r3">{if $vo.is_collection == 1}<a onclick="submitCollection({$vo.id})" href="javascript:;" style="color: red">收藏（{$vo.collection_sum}）</a>{else/}<a onclick="submitCollection({$vo.id})" href="javascript:;">收藏（{$vo.collection_sum}）</a>{/if}</p>
                            <p class="r4"><a onclick="handleModal({$vo.id})" href="javascript:;" class="md-trigger"
                                             data-modal="modal-1">打赏（{$vo.reward_sum}人）</a></p>
                            <a href="/addons/shop/info/detail?article_id={$vo.id}">查看详情></a>
                        </div>
                    </li>
                    {/foreach}
                </ul>
            </div>

            <div class="fenye">
                <div class="pager">
                    <ul class="pagination">
                        {$infoList->render()}
                    </ul>
                </div>
            </div>

        </div>

    </div>
</div>

<div class="md-modal md-effect-1" id="modal-1">

    <div class="md-content">
        <h3>资讯打赏</h3>
        <form action="/addons/shop/info/reward" method="post">
            <input type="hidden" name="article_id">
            <input type="hidden" name="method" value="web">
            <h6><input name="reward_money" type="text" value="" class="rh_tx_zx_s"/>元</h6>
            <h6><input data-id="" type="submit" value="支付" class="rh_tx_zx_ss submit-btn"/></h6>
        </form>
        <div>
            <button class="md-close btn-sm btn-primary">
                <img src="__CDN__/assets/img/img/guanbi.png" width="16" height="16"/>
            </button>
        </div>
    </div>

</div>

<script>
    function handleModal(id) {
        $("input[name=article_id]").val(id)
    }

    function submitFabulous(article_id) {
        SHOP.api.ajax(
            {
                url : "/addons/shop/info/fabulous",
                data: {article_id}
            },
            function () {
                location.reload()
            },
            function (data, ret) {
                if (ret.msg.indexOf("请登录") > -1) {
                    layer.alert("请登录后再进行操作", {
                        title: "温馨提示", icon: 0, btn: ["去登录"]
                    });
                    return false;
                }
            });
    }

    function submitCollection(article_id) {
        SHOP.api.ajax(
            {
                url : "/addons/shop/info/collection",
                data: {article_id}
            },
            function () {
                location.reload()
            },
            function (data, ret) {
                if (ret.msg.indexOf("请登录") > -1) {
                    layer.alert("请登录后再进行操作", {
                        title: "温馨提示", icon: 0, btn: ["去登录"]
                    });
                    return false;
                }
            });
    }

    function thisAlert(text) {
        layer.alert(text, {
            title: "提示", icon: 0, btn: ["确定"]
        });
    }
</script>
